using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Data;

namespace DataAccessLayer
{
   public  class Admin
    {
        private string adminId;
        private string password;
        private string email;
        private string connstring;

        public Admin(string connstring)
        {
             this.connstring = connstring;
        }
        public string ADMINID
        {
            get { return adminId; }
            set { adminId = value; }
        }
        public string PASSWORD
        {
            get { return password; }
            set { password = value; }
        }
        public string EMAIL
        {
            get { return email; }
            set { email = value; }
        }

        public int funcVerification()
        {
            int k = 0;

            SqlConnection objCon = new SqlConnection(connstring);
            objCon.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = objCon;
            cmd.CommandText = "sp_admin_login";
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            ds.Clear();
            da.Fill(ds);
            int i = ds.Tables[0].Rows.Count;

            for (int j = 0; j < i; j++)
            {
                if (adminId == ds.Tables[0].Rows[j]["AdminId"].ToString() && email == ds.Tables[0].Rows[j]["Email"].ToString() && password == ds.Tables[0].Rows[j]["Password"].ToString())
                {
                    k = 1;
                    break;
                }
            }
            return k;
        }
       /*  public int deleteDoctor(string regNo)
       {
           SqlConnection objCon = new SqlConnection(connstring);
           objCon.Open();
           SqlCommand cmd = new SqlCommand();
           cmd.Connection = objCon;
           cmd.CommandText = "sp_admin_login";
           cmd.CommandType = CommandType.StoredProcedure;
       }*/
    }
}
